//
//  YUTabbarButton.m
//  QQZone
//
//  Created by 张洪毓 on 15/11/25.
//  Copyright © 2015年 张洪毓. All rights reserved.
//

#import "YUTabbarButton.h"

@implementation YUTabbarButton

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.imageView.contentMode = UIViewContentModeCenter;
    }
    return self;
}

-(CGRect)titleRectForContentRect:(CGRect)contentRect{
    if (self.width > kButtonWidth) {
        return CGRectMake(self.width * 0.3, 0, self.width * (1 - 0.3), self.height);
    }else {
        return CGRectZero;
    }
}


-(CGRect)imageRectForContentRect:(CGRect)contentRect{
    if (self.width > kButtonWidth) {
        return CGRectMake(0, 0, self.width * 0.3, self.height);
    }else{
        return self.bounds;
    }
}

@end
